//
//  UIImage+LYCategory.m
//  BaChat
//
//  Created by 刘洋 on 16/6/27.
//  Copyright © 2016年 刘洋. All rights reserved.
//

#import "UIImage+LYCategory.h"

@implementation UIImage (LYCategory)

+(UIImage *)resizableImageWithName:(NSString *)imageName{
    //加载原有图片
    UIImage *norImage = [UIImage imageNamed:imageName];
    
    // 获取原有图片的宽高的一半
    CGFloat w = norImage.size.width * 0.5;
    CGFloat top = norImage.size.height * 0.5;
    CGFloat bottom = norImage.size.height-top;
    // 生成可以拉伸指定位置的图片
    UIImage *newImage = [norImage resizableImageWithCapInsets:UIEdgeInsetsMake(top, w, bottom, w) resizingMode:UIImageResizingModeStretch];
    
    return newImage;

    
    
}


@end
